package com.atguigu03.field_method.method.exer;

/**
 * ClassName: exer1
 * Description:
 *将属性测试的exer1中关于员工信息的输出内容放到方法中。通过调用方法显示。
 * @Author liu
 * @Create 2024/8/18 16:30
 * @Version 1.0
 */

public class exer1 {
    public static  void main(String[] args) {
        Exer p1 = new Exer();
        p1.name = "LUCY";
        p1.age = 18;
        p1.id = "AAA111";
        p1.salary = 3444.5;
        //返回 void 类型
        p1.print1();
        //System.out.println(p1.print1()); 报错 没有返回值
        //返回 string 类型
        System.out.println(p1.print2());


    }

}
//创建类
class Exer {
    String id;
    public String name;
    int age;
    double salary;//薪资
    public void print1(){
        System.out.println("id = " + id + ",name = " + name +
                ", age = " + age + ", salary = " + salary);
    }
    public String print2() {
        return "id = " + id + ",name = " + name +
                ", age = " + age + ", salary = " + salary;

    }
}